package com.lx.oms.controller.service.impl;

import java.math.BigInteger;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lx.oms.common.entity.Page;
import com.lx.oms.common.entity.Query;
import com.lx.oms.common.entity.R;
import com.lx.oms.common.utils.CommonUtils;
import com.lx.oms.controller.entity.WOrderEntity;
import com.lx.oms.controller.manager.WOrderManager;
import com.lx.oms.controller.service.WOrderService;

/**
 * 微信下单
 *
 * @author houzhong
 * @date 2018年8月08日 上午10:44:01
 */
@Service("wOrderService")
public class WOrderServiceImpl implements WOrderService {

	@Autowired
	private WOrderManager wOrderManager;

	@Override
	public Page<WOrderEntity> listWOrder(Map<String, Object> params) {
		Query query = new Query(params);
		Page<WOrderEntity> page = new Page<>(query);
		wOrderManager.listWOrder(page, query);
		return page;
	}

	@Override
	public R saveWOrder(WOrderEntity role) {
		int count = wOrderManager.saveWOrder(role);
		return CommonUtils.msg(count);
	}

	@Override
	public R getWOrderById(BigInteger id) {
		WOrderEntity wOrder = wOrderManager.getWOrderById(id);
		return CommonUtils.msg(wOrder);
	}

	@Override
	public R updateWOrder(WOrderEntity wOrder) {
		int count = wOrderManager.updateWOrder(wOrder);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(String[] id) {
		int count = wOrderManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
